package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution114 {
    public void flatten(TreeNode root) {
        TreeUtils.flatten(root);
    }
}

public class leetcode114 {
    public static void main(String[] args) {
        Solution114 solution114 = new Solution114();
        Integer[] nums = {1, 2, 5, 3, 4, null, 6};
        test114(solution114, nums);
    }

    private static void test114(Solution114 solution114, Integer[] nums) {
        TreeNode root = TreeUtils.generateLeetcodeTree(nums);
        solution114.flatten(root);
        System.out.println(TreeUtils.getLeetcodeTreeVals(root));
    }
}
